import requests
from bs4 import BeautifulSoup


start_url = 'http://books.toscrape.com/'
next_page_url = start_url
while next_page_url:
    r = requests.get(next_page_url)
    r.raise_for_status()
    bs = BeautifulSoup(r.text,'html.parser')

    next_page = bs.find('li',class_='next')
    print(next_page)
    next_page_url = next_page.a['href']
    print(next_page_url)
    next_page_url = start_url + next_page_url
    print(next_page_url)
    li_list = bs.find_all('li',class_='col-xs-6 col-sm-4 col-md-3 col-lg-3')
    for li in li_list:
        print(li.article.h3.a.text)
        print(li.article.div.a.img['src'])
        print(li.article.p['class'])